package Q1;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String strA = scanner.next();
        String strB = scanner.next();

        int len1 = strA.length();
        int len2 = strB.length();

        int diff = 0;
        int ret = Integer.MAX_VALUE;
        while (diff <= len2 - len1) {
            String subB = strB.substring(diff, len1 + diff);
            int count = 0;
            for (int i = 0; i < len1; i++) {
                if (strA.charAt(i) != subB.charAt(i)) {
                    count++;
                }
            }
            ret = Math.min(ret, count);
            diff++;
        }

        System.out.println(ret);
    }
}
